package com.mingserve.raw.domain.vo;

import lombok.Data;

@Data
public class RawVo
{
    private Long timestamp;
    /**
     * x点值
     */
    private double[] x;
    /**
     * y点值
     */
    private double[] y;
    /**
     * z点值
     */
    private double[] z;
    /**
     * 采集间隔
     */
    private double[] t;

    /**
     * 获取数据长度
     *
     * @return
     */
    public int getLength()
    {
        return x != null ? x.length : y != null ? y.length : z != null ? z.length : 0;
    }

    public void setValues(double[] x, double[] y, double[] z, String axial) {
        switch (axial) {
            case "x":
                this.x = x;
                break;
            case "y":
                this.y = y;
                break;
            case "z":
                this.z = z;
                break;
            case "xyz":
                this.x = x;
                this.y = y;
                this.z = z;
                break;
            default:
                break;
        }
    }
    public void setValues(double[] values, String axial) {
        switch (axial) {
            case "x":
                this.x = values;
                break;
            case "y":
                this.y = values;
                break;
            case "z":
                this.z = values;
                break;
            default:
                break;
        }
    }
}
